package com.kkb.kkbportal.controller;

import com.kkb.kkbcommon.api.CommonResult;
import com.kkb.kkbportal.domain.ums.User;
import com.kkb.kkbportal.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "administratorController", description = "后台管理员管理员")
@RequestMapping("/administrator")
public class AdministratorController {

    @Autowired
    private UserService userService;

    @ApiOperation(value = "管理员登录", notes = "管理员登录接口")
    @ApiImplicitParam(name = "condition", value = "管理员登录所需信息", dataType = "User")
    @PostMapping("/login")
    public CommonResult<User> login(@RequestBody @Validated User condition) {
        userService.userLogin(condition);
        return CommonResult.success(null, "登录成功");
    }

}
